package com.itheima.servlet;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Map;

@WebServlet("/login")
public class Login extends HttpServlet {
    //用户登录

    @Override//重写doGat
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //获取所有的提交的信息
        Map<String, String[]> map = req.getParameterMap();
        String name = map.get("name")[0];
        String gender = map.get("gender")[0];

        System.out.println("姓名:" + name);
        System.out.println("性别:" + gender);

    }

    @Override//重写doPost
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        this.doGet(req,resp);
    }
}
